{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}/Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/hazard.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}11 Apr 2017, 14:13:21

{com}. do "/var/folders/z2/qd98c80s3gz99pdxz_s_81h00000gn/T//SD76527.000000"
{txt}
{com}. * ==============================================================================
. *       Measuring Knowledge of Parties' Legislative Seat Shares
. *       Lee, Haime & Stevenson 
. *       Replication Do File: Hazard Rate (Figure 2)
. * ==============================================================================
. 
. set scheme sol /* ado file available at: https://dl.dropbox.com/u/3011470/scheme_sol.zip */
{txt}
{com}. 
. ********************************************************************************
. *****   Figure 2: UNITED KINGDOM   *********************************************
. ********************************************************************************
. 
. use "hazardUK.dta", clear
{txt}
{com}. 
. /** recode missing == 0 **/
. 
. set more off
{txt}
{com}.         destring partiesactivedup-partiesactivealliancepartyofnort, replace
{txt}partiesactivedup already numeric; no {res}replace
{txt}partiesactiveconservativeparty already numeric; no {res}replace
{txt}partiesactivelabourparty already numeric; no {res}replace
{txt}partiesactiveliberaldemocrats already numeric; no {res}replace
{txt}partiesactivesdlp already numeric; no {res}replace
{txt}partiesactivesnp already numeric; no {res}replace
{txt}partiesactiveplaidcymru already numeric; no {res}replace
{txt}partiesactiveukip already numeric; no {res}replace
{txt}partiesactivegreenpartyofengland already numeric; no {res}replace
{txt}partiesactivesinnfein already numeric; no {res}replace
{txt}partiesactiveuup already numeric; no {res}replace
{txt}partiesactivealliancepartyofnort already numeric; no {res}replace
{txt}
{com}.         egen recog=rowtotal(partiesactivedup-partiesactivealliancepartyofnort)
{txt}
{com}. 
.         destring lrplacementdup-lrplacementalliancepartyofnorthe, replace
{txt}lrplacementdup already numeric; no {res}replace
{txt}lrplacementconservativeparty already numeric; no {res}replace
{txt}lrplacementlabourparty already numeric; no {res}replace
{txt}lrplacementliberaldemocrats already numeric; no {res}replace
{txt}lrplacementsdlp already numeric; no {res}replace
{txt}lrplacementsnp already numeric; no {res}replace
{txt}lrplacementplaidcymru already numeric; no {res}replace
{txt}lrplacementukip already numeric; no {res}replace
{txt}lrplacementgreenpartyofenglandan already numeric; no {res}replace
{txt}lrplacementyourself already numeric; no {res}replace
{txt}lrplacementsinnfein already numeric; no {res}replace
{txt}lrplacementuup already numeric; no {res}replace
{txt}lrplacementalliancepartyofnorthe already numeric; no {res}replace
{txt}
{com}.         egen LRplace=rowtotal(lrplacementdup-lrplacementalliancepartyofnorthe)
{txt}
{com}. 
.         destring positiontaxconservativeparty-positiontaxukip, replace
{txt}positiontaxconservativeparty already numeric; no {res}replace
{txt}positiontaxlabourparty already numeric; no {res}replace
{txt}positiontaxliberaldemocraticpart already numeric; no {res}replace
{txt}positiontaxsnp already numeric; no {res}replace
{txt}positiontaxukip already numeric; no {res}replace
{txt}
{com}.         egen taxpos=rowtotal(positiontaxyourself-positiontaxukip)
{txt}
{com}. 
.         destring positioneuconservativeparty-positioneuukip, replace
{txt}positioneuconservativeparty already numeric; no {res}replace
{txt}positioneulabourparty already numeric; no {res}replace
{txt}positioneuliberaldemocraticparty already numeric; no {res}replace
{txt}positioneusnp already numeric; no {res}replace
{txt}positioneuukip already numeric; no {res}replace
{txt}
{com}.         egen eupos=rowtotal(positioneuconservativeparty-positioneuukip)
{txt}
{com}. 
.         destring positionscotlandconservativepart-positionscotlandukindependencepa, replace
{txt}positionscotlandconservativepart already numeric; no {res}replace
{txt}positionscotlandlabourparty already numeric; no {res}replace
{txt}positionscotlandliberaldemocrati already numeric; no {res}replace
{txt}positionscotlandscottishnational already numeric; no {res}replace
{txt}positionscotlandukindependencepa already numeric; no {res}replace
{txt}
{com}.         egen scotpos=rowtotal (positionscotlandyourself-positionscotlandukindependencepa)
{txt}
{com}. 
.         destring influencedup-influencealliancepartyofnorthern, replace
{txt}influencedup already numeric; no {res}replace
{txt}influenceconservativeparty already numeric; no {res}replace
{txt}influencelabourparty already numeric; no {res}replace
{txt}influenceliberaldemocrats already numeric; no {res}replace
{txt}influencesdlp already numeric; no {res}replace
{txt}influencesnp already numeric; no {res}replace
{txt}influenceplaidcymru already numeric; no {res}replace
{txt}influenceukip already numeric; no {res}replace
{txt}influencegreenpartyofenglandandw already numeric; no {res}replace
{txt}influencesinnfein already numeric; no {res}replace
{txt}influenceuup already numeric; no {res}replace
{txt}influencealliancepartyofnorthern already numeric; no {res}replace
{txt}
{com}.         egen influ=rowtotal(influencedup-influencealliancepartyofnorthern)
{txt}
{com}. 
.         destring freqingovtdup-freqingovtalliancepartyofnorther, replace
{txt}freqingovtdup already numeric; no {res}replace
{txt}freqingovtconservativeparty already numeric; no {res}replace
{txt}freqingovtlabourparty already numeric; no {res}replace
{txt}freqingovtliberaldemocrats already numeric; no {res}replace
{txt}freqingovtsdlp already numeric; no {res}replace
{txt}freqingovtsnp already numeric; no {res}replace
{txt}freqingovtplaidcymru already numeric; no {res}replace
{txt}freqingovtukip already numeric; no {res}replace
{txt}freqingovtgreenpartyofenglandand already numeric; no {res}replace
{txt}freqingovtsinnfein already numeric; no {res}replace
{txt}freqingovtuup already numeric; no {res}replace
{txt}freqingovtalliancepartyofnorther already numeric; no {res}replace
{txt}
{com}.         egen freqgov=rowtotal(freqingovtdup-freqingovtalliancepartyofnorther)
{txt}
{com}. 
.         destring  currentroledup-currentrolealliancepartyofnorthe, replace
{txt}currentroledup already numeric; no {res}replace
{txt}currentroleconservativeparty already numeric; no {res}replace
{txt}currentrolelabourparty already numeric; no {res}replace
{txt}currentroleliberaldemocrats already numeric; no {res}replace
{txt}currentrolesdlp already numeric; no {res}replace
{txt}currentrolesnp already numeric; no {res}replace
{txt}currentroleplaidcymru already numeric; no {res}replace
{txt}currentroleukip already numeric; no {res}replace
{txt}currentrolegreenpartyofenglandan already numeric; no {res}replace
{txt}currentrolesinnfein already numeric; no {res}replace
{txt}currentroleuup already numeric; no {res}replace
{txt}currentrolealliancepartyofnorthe already numeric; no {res}replace
{txt}
{com}.         egen role=rowtotal(currentroledup-currentrolealliancepartyofnorthe)
{txt}
{com}. 
.         destring ministershiptreasury-ministershiphomeoffice, replace
{txt}ministershiptreasury already numeric; no {res}replace
{txt}ministershipbusinessinnovationan already numeric; no {res}replace
{txt}ministershipcommunitiesandlocalg already numeric; no {res}replace
{txt}ministershipculturemediaandsport already numeric; no {res}replace
{txt}ministershipeducation already numeric; no {res}replace
{txt}ministershipenvironment already numeric; no {res}replace
{txt}ministershipinternationaldevelop already numeric; no {res}replace
{txt}ministershiptransport already numeric; no {res}replace
{txt}ministershipworkandpensions already numeric; no {res}replace
{txt}ministershipenergyandclimatechan already numeric; no {res}replace
{txt}ministershiphealth already numeric; no {res}replace
{txt}ministershipforeignoffice already numeric; no {res}replace
{txt}ministershipscotlandoffice already numeric; no {res}replace
{txt}ministershipwalesoffice already numeric; no {res}replace
{txt}ministershipnorthernirelandoffic already numeric; no {res}replace
{txt}ministershipjustice already numeric; no {res}replace
{txt}ministershipdefence already numeric; no {res}replace
{txt}ministershiphomeoffice already numeric; no {res}replace
{txt}
{com}.         egen ministership=rowtotal(ministershiptreasury-ministershiphomeoffice) 
{txt}
{com}.         egen temp1 = anymatch(currentroledup-currentrolealliancepartyofnorthe), values(1)
{res}{txt}
{com}.         egen temp2 = anymatch(currentroledup-currentrolealliancepartyofnorthe), values(2)
{res}{txt}
{com}.         replace ministership=999 if temp1==0&role!=0                    // Rs not shown with this question
{txt}(361 real changes made)

{com}.         replace ministership=999 if temp1==1&temp2==0&role!=0   // Rs not shown with this question
{txt}(148 real changes made)

{com}.         drop temp1 temp2
{txt}
{com}. 
.         destring econeval, replace 
{txt}econeval already numeric; no {res}replace
{txt}
{com}.         recode econeval .=0
{txt}(econeval: 199 changes made)

{com}. 
.         destring attentionchecktheguardian-attentioncheckdailystar, replace
{txt}attentionchecktheguardian already numeric; no {res}replace
{txt}attentioncheckthetimes already numeric; no {res}replace
{txt}attentioncheckbbc already numeric; no {res}replace
{txt}attentionchecktheindependent already numeric; no {res}replace
{txt}attentioncheckthedailymail already numeric; no {res}replace
{txt}attentioncheckthetelegraph already numeric; no {res}replace
{txt}attentioncheckskynews already numeric; no {res}replace
{txt}attentioncheckitn already numeric; no {res}replace
{txt}attentioncheckdailyexpress already numeric; no {res}replace
{txt}attentioncheckdailymirror already numeric; no {res}replace
{txt}attentioncheckthesun already numeric; no {res}replace
{txt}attentioncheckdailystar already numeric; no {res}replace
{txt}
{com}.         egen attentionscore= rowtotal(attentionchecktheguardian-attentioncheckdailystar)
{txt}
{com}.         recode attentionscore .=0
{txt}(attentionscore: 0 changes made)

{com}. 
.         destring earthquake, replace
{txt}earthquake already numeric; no {res}replace
{txt}
{com}.         recode earthquake .=0
{txt}(earthquake: 200 changes made)

{com}. 
.         destring eureferendumconservatives-eureferendumgreens, replace
{txt}eureferendumconservatives already numeric; no {res}replace
{txt}eureferendumlabour already numeric; no {res}replace
{txt}eureferendumliberaldemocrats already numeric; no {res}replace
{txt}eureferendumukip already numeric; no {res}replace
{txt}eureferendumsnp already numeric; no {res}replace
{txt}eureferendumgreens already numeric; no {res}replace
{txt}
{com}.         egen euref = rowtotal(eureferendumconservatives-eureferendumgreens)
{txt}
{com}. 
.         destring supportcarers, replace 
{txt}supportcarers already numeric; no {res}replace
{txt}
{com}.         recode supportcarers .=0
{txt}(supportcarers: 201 changes made)

{com}. 
.         destring  seatsrandom_dup-seatsrandom_alliance, replace
{txt}seatsrandom_dup already numeric; no {res}replace
{txt}seatsrandom_cons already numeric; no {res}replace
{txt}seatsrandom_lab already numeric; no {res}replace
{txt}seatsrandom_libdem already numeric; no {res}replace
{txt}seatsrandom_sdlp already numeric; no {res}replace
{txt}seatsrandom_snp already numeric; no {res}replace
{txt}seatsrandom_pc already numeric; no {res}replace
{txt}seatsrandom_ukip already numeric; no {res}replace
{txt}seatsrandom_green already numeric; no {res}replace
{txt}seatsrandom_sf already numeric; no {res}replace
{txt}seatsrandom_uup already numeric; no {res}replace
{txt}seatsrandom_alliance already numeric; no {res}replace
{txt}
{com}.         egen seats1=rowtotal(seatsrandom_dup-seatsrandom_alliance)
{txt}
{com}. 
.         destring seatsfixed_dup-seatsfixed_alliance, replace
{txt}seatsfixed_dup already numeric; no {res}replace
{txt}seatsfixed_cons already numeric; no {res}replace
{txt}seatsfixed_lab already numeric; no {res}replace
{txt}seatsfixed_libdem already numeric; no {res}replace
{txt}seatsfixed_snp already numeric; no {res}replace
{txt}seatsfixed_sdlp already numeric; no {res}replace
{txt}seatsfixed_pc already numeric; no {res}replace
{txt}seatsfixed_ukip already numeric; no {res}replace
{txt}seatsfixed_green already numeric; no {res}replace
{txt}seatsfixed_sf already numeric; no {res}replace
{txt}seatsfixed_uup already numeric; no {res}replace
{txt}seatsfixed_alliance already numeric; no {res}replace
{txt}
{com}.         egen seats2=rowtotal(seatsfixed_dup-seatsfixed_alliance)
{txt}
{com}. 
.         destring percentrandom_dup-percentrandom_alliance, replace
{txt}percentrandom_dup already numeric; no {res}replace
{txt}percentrandom_cons already numeric; no {res}replace
{txt}percentrandom_lab already numeric; no {res}replace
{txt}percentrandom_libdem already numeric; no {res}replace
{txt}percentrandom_sdlp already numeric; no {res}replace
{txt}percentrandom_snp already numeric; no {res}replace
{txt}percentrandom_pc already numeric; no {res}replace
{txt}percentrandom_ukip already numeric; no {res}replace
{txt}percentrandom_green already numeric; no {res}replace
{txt}percentrandom_sf already numeric; no {res}replace
{txt}percentrandom_uup already numeric; no {res}replace
{txt}percentrandom_alliance already numeric; no {res}replace
{txt}
{com}.         egen seats3=rowtotal(percentrandom_dup-percentrandom_alliance)
{txt}
{com}.         
.         destring percentfixed_dup-percentfixed_alliance, replace
{txt}percentfixed_dup already numeric; no {res}replace
{txt}percentfixed_cons already numeric; no {res}replace
{txt}percentfixed_lab already numeric; no {res}replace
{txt}percentfixed_libdem already numeric; no {res}replace
{txt}percentfixed_sdlp already numeric; no {res}replace
{txt}percentfixed_snp already numeric; no {res}replace
{txt}percentfixed_pc already numeric; no {res}replace
{txt}percentfixed_ukip already numeric; no {res}replace
{txt}percentfixed_green already numeric; no {res}replace
{txt}percentfixed_sf already numeric; no {res}replace
{txt}percentfixed_uup already numeric; no {res}replace
{txt}percentfixed_alliance already numeric; no {res}replace
{txt}
{com}.         egen seats4=rowtotal(percentfixed_dup-percentfixed_alliance)
{txt}
{com}. 
.         egen seats=rowtotal(seats1 seats2 seats3 seats4)
{txt}
{com}. 
. 
. /** Recode all these variables: missing == 1 and non-missing == 0;
>         keep them in the order in which they appeared in the survey **/
. 
.         set more off
{txt}
{com}.         foreach var of varlist recog LRplace taxpos eupos scotpos influ freqgov role ministership econeval attentionscore earthquake euref supportcarers seats {c -(}
{txt}  2{com}.                 recode `var' 0=1 *=0
{txt}  3{com}.         {c )-}
{txt}(recog: 1665 changes made)
(LRplace: 1665 changes made)
(taxpos: 1665 changes made)
(eupos: 1665 changes made)
(scotpos: 1665 changes made)
(influ: 1665 changes made)
(freqgov: 1665 changes made)
(role: 1665 changes made)
(ministership: 1665 changes made)
(econeval: 1665 changes made)
(attentionscore: 1665 changes made)
(earthquake: 1665 changes made)
(euref: 1665 changes made)
(supportcarers: 1665 changes made)
(seats: 1665 changes made)

{com}. 
. /** When a person has dropped out there will be a set of consecutive ones in the each of these variables;
>         we started with 1665 individuals, 23 dropped out at the first question;
>         get one line with the number who have dropped out at each question **/
. 
.         collapse (sum) recog LRplace taxpos eupos scotpos influ freqgov role  ministership econeval attentionscore earthquake euref supportcarers seats 
{txt}
{com}. 
. /** make the columns rows **/
. 
.         local aa=1
{txt}
{com}.         foreach var of varlist recog LRplace taxpos eupos scotpos influ freqgov role ministership econeval attentionscore earthquake euref supportcarers seats {c -(}
{txt}  2{com}.                 rename `var' var`aa'
{txt}  3{com}.                 local aa=`aa'+1
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. 
.         gen index=1
{txt}
{com}.         reshape long var, i(index) j(j)
{txt}(note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)

Data{col 36}wide{col 43}->{col 48}long
{hline 77}
Number of obs.                 {res}       1   {txt}->{res}      15
{txt}Number of variables            {res}      16   {txt}->{res}       3
{txt}j variable (15 values)                    ->   {res}j
{txt}xij variables:
                    {res}var1 var2 ... var15   {txt}->   {res}var
{txt}{hline 77}

{com}.         drop index
{txt}
{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c TRC}
     {c |} {res} j   var {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
  1. {c |} {res} 1    23 {txt}{c |}
  2. {c |} {res} 2    84 {txt}{c |}
  3. {c |} {res} 3   113 {txt}{c |}
  4. {c |} {res} 4   119 {txt}{c |}
  5. {c |} {res} 5   127 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
  6. {c |} {res} 6   142 {txt}{c |}
  7. {c |} {res} 7   149 {txt}{c |}
  8. {c |} {res} 8   163 {txt}{c |}
  9. {c |} {res} 9   193 {txt}{c |}
 10. {c |} {res}10   199 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
 11. {c |} {res}11   199 {txt}{c |}
 12. {c |} {res}12   200 {txt}{c |}
 13. {c |} {res}13   200 {txt}{c |}
 14. {c |} {res}14   201 {txt}{c |}
 15. {c |} {res}15   232 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c BRC}

{com}. 
. /** we started with 1665 individuals; add a column to count how many people reached the question  */
. 
.         tsset j
{res}{txt}{col 9}time variable:  {res}{col 25}j, 1 to 15
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}.         gen surviors= 1665-l.var
{txt}(1 missing value generated)

{com}.         replace surviors= 1665 in 1
{txt}(1 real change made)

{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c TRC}
     {c |} {res} j   var   surviors {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
  1. {c |} {res} 1    23       1665 {txt}{c |}
  2. {c |} {res} 2    84       1642 {txt}{c |}
  3. {c |} {res} 3   113       1581 {txt}{c |}
  4. {c |} {res} 4   119       1552 {txt}{c |}
  5. {c |} {res} 5   127       1546 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
  6. {c |} {res} 6   142       1538 {txt}{c |}
  7. {c |} {res} 7   149       1523 {txt}{c |}
  8. {c |} {res} 8   163       1516 {txt}{c |}
  9. {c |} {res} 9   193       1502 {txt}{c |}
 10. {c |} {res}10   199       1472 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
 11. {c |} {res}11   199       1466 {txt}{c |}
 12. {c |} {res}12   200       1466 {txt}{c |}
 13. {c |} {res}13   200       1465 {txt}{c |}
 14. {c |} {res}14   201       1465 {txt}{c |}
 15. {c |} {res}15   232       1464 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c BRC}

{com}. 
. /* now we have the total number of people who have quit by each question and the number who reached the question;
>    now we need the number who quit at each question (not the total who have quit by then) */
. 
.         gen fails=var-l.var
{txt}(1 missing value generated)

{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c TRC}
     {c |} {res} j   var   surviors   fails {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  1. {c |} {res} 1    23       1665       . {txt}{c |}
  2. {c |} {res} 2    84       1642      61 {txt}{c |}
  3. {c |} {res} 3   113       1581      29 {txt}{c |}
  4. {c |} {res} 4   119       1552       6 {txt}{c |}
  5. {c |} {res} 5   127       1546       8 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  6. {c |} {res} 6   142       1538      15 {txt}{c |}
  7. {c |} {res} 7   149       1523       7 {txt}{c |}
  8. {c |} {res} 8   163       1516      14 {txt}{c |}
  9. {c |} {res} 9   193       1502      30 {txt}{c |}
 10. {c |} {res}10   199       1472       6 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
 11. {c |} {res}11   199       1466       0 {txt}{c |}
 12. {c |} {res}12   200       1466       1 {txt}{c |}
 13. {c |} {res}13   200       1465       0 {txt}{c |}
 14. {c |} {res}14   201       1465       1 {txt}{c |}
 15. {c |} {res}15   232       1464      31 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c BRC}

{com}.         replace fail=23 in 1
{txt}(1 real change made)

{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c TRC}
     {c |} {res} j   var   surviors   fails {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  1. {c |} {res} 1    23       1665      23 {txt}{c |}
  2. {c |} {res} 2    84       1642      61 {txt}{c |}
  3. {c |} {res} 3   113       1581      29 {txt}{c |}
  4. {c |} {res} 4   119       1552       6 {txt}{c |}
  5. {c |} {res} 5   127       1546       8 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  6. {c |} {res} 6   142       1538      15 {txt}{c |}
  7. {c |} {res} 7   149       1523       7 {txt}{c |}
  8. {c |} {res} 8   163       1516      14 {txt}{c |}
  9. {c |} {res} 9   193       1502      30 {txt}{c |}
 10. {c |} {res}10   199       1472       6 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
 11. {c |} {res}11   199       1466       0 {txt}{c |}
 12. {c |} {res}12   200       1466       1 {txt}{c |}
 13. {c |} {res}13   200       1465       0 {txt}{c |}
 14. {c |} {res}14   201       1465       1 {txt}{c |}
 15. {c |} {res}15   232       1464      31 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c BRC}

{com}. 
. /* Get the hazard rate for each question */
.    
.         capture drop hazard
{txt}
{com}.         gen hazard=fail/surviors
{txt}
{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c TRC}
     {c |} {res} j   var   surviors   fails     hazard {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
  1. {c |} {res} 1    23       1665      23   .0138138 {txt}{c |}
  2. {c |} {res} 2    84       1642      61   .0371498 {txt}{c |}
  3. {c |} {res} 3   113       1581      29   .0183428 {txt}{c |}
  4. {c |} {res} 4   119       1552       6    .003866 {txt}{c |}
  5. {c |} {res} 5   127       1546       8   .0051746 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
  6. {c |} {res} 6   142       1538      15   .0097529 {txt}{c |}
  7. {c |} {res} 7   149       1523       7   .0045962 {txt}{c |}
  8. {c |} {res} 8   163       1516      14   .0092348 {txt}{c |}
  9. {c |} {res} 9   193       1502      30   .0199734 {txt}{c |}
 10. {c |} {res}10   199       1472       6   .0040761 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
 11. {c |} {res}11   199       1466       0          0 {txt}{c |}
 12. {c |} {res}12   200       1466       1   .0006821 {txt}{c |}
 13. {c |} {res}13   200       1465       0          0 {txt}{c |}
 14. {c |} {res}14   201       1465       1   .0006826 {txt}{c |}
 15. {c |} {res}15   232       1464      31   .0211749 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c BRC}

{com}. 
. /** [Figure 2] UK Graph **/
. 
.         gen varlab=""  
{txt}(15 missing values generated)

{com}.         local kk=1
{txt}
{com}.         foreach vv in "Party recognition" "Party LR position" "Party tax position" ///
>                 "Party EU position" "Party scottish position"  "Party policy influence" ///
>                 "Party frequency in cabinet" "Party role in cabinet" "Party control of ministeries" ///
>                 "Evaluation of economy" "Media use: attention test" "Knowledge: earthquake" ///
>                 "Knowledge: EU referendum" "Knowledge: support carers" "Expected seats" {c -(} 
{txt}  2{com}.                 replace varlab="`vv'" in `kk' 
{txt}  3{com}.                 local kk=`kk'+1
{txt}  4{com}.         {c )-}
{txt}varlab was {res}str1{txt} now {res}str17
{txt}(1 real change made)
(1 real change made)
varlab was {res}str17{txt} now {res}str18
{txt}(1 real change made)
(1 real change made)
varlab was {res}str18{txt} now {res}str23
{txt}(1 real change made)
(1 real change made)
varlab was {res}str23{txt} now {res}str26
{txt}(1 real change made)
(1 real change made)
varlab was {res}str26{txt} now {res}str28
{txt}(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)

{com}.         set more off
{txt}
{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 30}{c TRC}
     {c |} {res} j   var   surviors   fails     hazard                         varlab {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 30}{c RT}
  1. {c |} {res} 1    23       1665      23   .0138138              Party recognition {txt}{c |}
  2. {c |} {res} 2    84       1642      61   .0371498              Party LR position {txt}{c |}
  3. {c |} {res} 3   113       1581      29   .0183428             Party tax position {txt}{c |}
  4. {c |} {res} 4   119       1552       6    .003866              Party EU position {txt}{c |}
  5. {c |} {res} 5   127       1546       8   .0051746        Party scottish position {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 30}{c RT}
  6. {c |} {res} 6   142       1538      15   .0097529         Party policy influence {txt}{c |}
  7. {c |} {res} 7   149       1523       7   .0045962     Party frequency in cabinet {txt}{c |}
  8. {c |} {res} 8   163       1516      14   .0092348          Party role in cabinet {txt}{c |}
  9. {c |} {res} 9   193       1502      30   .0199734   Party control of ministeries {txt}{c |}
 10. {c |} {res}10   199       1472       6   .0040761          Evaluation of economy {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 30}{c RT}
 11. {c |} {res}11   199       1466       0          0      Media use: attention test {txt}{c |}
 12. {c |} {res}12   200       1466       1   .0006821          Knowledge: earthquake {txt}{c |}
 13. {c |} {res}13   200       1465       0          0       Knowledge: EU referendum {txt}{c |}
 14. {c |} {res}14   201       1465       1   .0006826      Knowledge: support carers {txt}{c |}
 15. {c |} {res}15   232       1464      31   .0211749                 Expected seats {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 30}{c BRC}

{com}. 
.         graph bar hazard, over(varlab, sort(j)) ylabel(0(0.02)0.06) horizontal ///
>                 ytitle("Hazard Rate") title("United Kingdom") name(figure2_uk, replace)
{res}{txt}
{com}.         
.         
. ********************************************************************************
. *****   Figure 2: DENMARK   ****************************************************
. ********************************************************************************
. 
. use "hazardDK.dta", clear
{txt}
{com}. set scheme sol
{txt}
{com}. 
. /** recode missing == 0 **/
. 
. set more off
{txt}
{com}.         destring polint, replace 
{txt}polint has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(4 missing values generated)

{com}.         recode polint .=0
{txt}(polint: 4 changes made)

{com}. 
.         destring polknowledge, replace
{txt}polknowledge has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(8 missing values generated)

{com}.         recode polknowledge .=0
{txt}(polknowledge: 8 changes made)

{com}. 
.         destring  q7_1-q7_10, replace
{txt}q7_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(214 missing values generated)
q7_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(376 missing values generated)
q7_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(416 missing values generated)
q7_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(448 missing values generated)
q7_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(374 missing values generated)
q7_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(848 missing values generated)
q7_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(213 missing values generated)
q7_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(220 missing values generated)
q7_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(325 missing values generated)
q7_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(723 missing values generated)

{com}.         egen recog=rowtotal(q7_1-q7_10)
{txt}
{com}. 
.         destring  q9_1-q9_10, replace
{txt}q9_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_99 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)
q9_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(120 missing values generated)

{com}.         egen LRplace=rowtotal(q9_1-q9_10)
{txt}
{com}. 
.         destring  q11_1-q11_10, replace
{txt}q11_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)
q11_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(227 missing values generated)

{com}.         egen taxpos=rowtotal(q11_1-q11_10)
{txt}
{com}. 
.         destring  q13_1-q13_10, replace
{txt}q13_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)
q13_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(268 missing values generated)

{com}.         egen eupos=rowtotal(q13_1-q13_10)
{txt}
{com}. 
.         destring  q15_1-q15_10, replace
{txt}q15_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)
q15_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(288 missing values generated)

{com}.         egen aslpos=rowtotal(q15_1-q15_10)
{txt}
{com}. 
.         destring  q17_2-q17_1, replace
{txt}q17_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)
q17_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(322 missing values generated)

{com}.         egen influ=rowtotal(q17_2-q17_1)
{txt}
{com}. 
.         destring  q19_1-q19_10, replace
{txt}q19_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)
q19_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(328 missing values generated)

{com}.         egen freqgov=rowtotal(q19_1-q19_10)
{txt}
{com}. 
.         destring  q21_1-q21_10, replace
{txt}q21_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_7 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_8 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_9 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)
q21_10 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(359 missing values generated)

{com}.         egen role=rowtotal(q21_1-q21_10)
{txt}
{com}. 
.         rename q25 econeval
{res}{txt}
{com}.         destring econeval, replace 
{txt}econeval has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(372 missing values generated)

{com}.         recode econeval .=0
{txt}(econeval: 372 changes made)

{com}. 
.         rename q29 newsscand
{res}{txt}
{com}.         destring newsscand, replace 
{txt}newsscand has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(377 missing values generated)

{com}.         recode newsscand .=0
{txt}(newsscand: 377 changes made)

{com}. 
.         destring  q31_1-q31_6, replace
{txt}q31_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(381 missing values generated)
q31_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(381 missing values generated)
q31_3 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(381 missing values generated)
q31_4 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(381 missing values generated)
q31_5 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(381 missing values generated)
q31_6 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(381 missing values generated)

{com}.         egen newsuk=rowtotal(q31_1-q31_6)
{txt}
{com}. 
.         rename q33 newswork
{res}{txt}
{com}.         destring newswork, replace 
{txt}newswork has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(382 missing values generated)

{com}.         recode newswork .=0
{txt}(newswork: 382 changes made)

{com}. 
.         foreach var of varlist q37-q46 {c -(}
{txt}  2{com}.         destring `var', replace 
{txt}  3{com}.         recode `var' .=0
{txt}  4{com}.         {c )-}
{txt}q37 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q37: 390 changes made)
q38 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q38: 390 changes made)
q39 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q39: 390 changes made)
q40 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q40: 390 changes made)
q41 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q41: 390 changes made)
q42 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q42: 390 changes made)
q43 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q43: 390 changes made)
q44 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q44: 390 changes made)
q45 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q45: 390 changes made)
q46 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(390 missing values generated)
(q46: 390 changes made)

{com}. 
.         rename q49 voteint
{res}{txt}
{com}.         destring voteint, replace 
{txt}voteint has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(391 missing values generated)

{com}.         recode voteint .=0
{txt}(voteint: 391 changes made)

{com}. 
.         destring  q51_1_16-q51_10_16, replace
{txt}q51_1_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1560 missing values generated)
q51_2_16 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1559 missing values generated)
q51_3_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1559 missing values generated)
q51_4_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1558 missing values generated)
q51_5_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1559 missing values generated)
q51_6_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1558 missing values generated)
q51_7_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1559 missing values generated)
q51_8_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1558 missing values generated)
q51_9_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1558 missing values generated)
q51_10_16 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1557 missing values generated)

{com}.         egen seats1=rowtotal(q51_1_16-q51_10_16)
{txt}
{com}. 
.         destring q53_9_2-q53_10_2, replace
{txt}q53_9_2 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1550 missing values generated)
q53_1_2 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1551 missing values generated)
q53_2_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1550 missing values generated)
q53_3_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1551 missing values generated)
q53_4_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1550 missing values generated)
q53_8_2 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1550 missing values generated)
q53_6_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1550 missing values generated)
q53_5_2 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1550 missing values generated)
q53_7_2 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1550 missing values generated)
q53_10_2 has all characters numeric; {res}replaced {txt}as {res}int
{txt}(1550 missing values generated)

{com}.         egen seats2=rowtotal(q53_9_2-q53_10_2)
{txt}
{com}. 
.         destring  q55_1_1-q55_10_1, replace
{txt}q55_1_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_2_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_3_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_4_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_5_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_6_1 has all characters numeric; {res}replaced {txt}as {res}double
{txt}(1544 missing values generated)
q55_7_1 has all characters numeric; {res}replaced {txt}as {res}double
{txt}(1543 missing values generated)
q55_8_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_9_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)
q55_10_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1543 missing values generated)

{com}.         egen seats3=rowtotal(q55_1_1-q55_10_1)
{txt}
{com}. 
.         destring  q57_9_1-q57_10_1, replace
{txt}q57_9_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_1_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1546 missing values generated)
q57_2_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_3_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_8_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1546 missing values generated)
q57_4_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_6_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_5_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_7_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1547 missing values generated)
q57_10_1 has all characters numeric; {res}replaced {txt}as {res}byte
{txt}(1548 missing values generated)

{com}.         egen seats4=rowtotal(q57_9_1-q57_10_1)
{txt}
{com}. 
.         egen seats=rowtotal(seats1 seats2 seats3 seats4)
{txt}
{com}. 
.         
. /** Recode all these variables: missing == 1 and non-missing == 0;
>         keep them in the order in which they appeared in the survey **/
. 
.         set more off
{txt}
{com}.         foreach var of varlist polint polknowledge recog LRplace taxpos eupos aslpos influ freqgov role econeval newsscand newsuk newswork voteint seats {c -(}
{txt}  2{com}.                 recode `var' 0=1 *=0
{txt}  3{com}. {c )-}
{txt}(polint: 1917 changes made)
(polknowledge: 1917 changes made)
(recog: 1917 changes made)
(LRplace: 1917 changes made)
(taxpos: 1917 changes made)
(eupos: 1917 changes made)
(aslpos: 1917 changes made)
(influ: 1917 changes made)
(freqgov: 1917 changes made)
(role: 1917 changes made)
(econeval: 1917 changes made)
(newsscand: 1917 changes made)
(newsuk: 1917 changes made)
(newswork: 1917 changes made)
(voteint: 1917 changes made)
(seats: 1917 changes made)

{com}. 
. /** When a person has dropped out there will be a set of consecutive ones in the each of these variables;
>         we started with 1917 individuals, 4 dropped out at the first question;
>         get one line with the number who have dropped out at each question **/
. 
.         collapse (sum) polint polknowledge recog LRplace taxpos eupos aslpos influ freqgov role econeval newsscand newsuk newswork voteint seats
{txt}
{com}. 
. /** make the columns rows */
. 
.         local aa=1
{txt}
{com}.         foreach var of varlist polint polknowledge recog LRplace taxpos eupos aslpos influ freqgov role econeval newsscand newsuk newswork voteint seats {c -(}
{txt}  2{com}.                 rename `var' var`aa'
{txt}  3{com}.                 local aa=`aa'+1
{txt}  4{com}.         {c )-}
{res}{txt}
{com}. 
.         gen index=1
{txt}
{com}.         reshape long var, i(index) j(j)
{txt}(note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)

Data{col 36}wide{col 43}->{col 48}long
{hline 77}
Number of obs.                 {res}       1   {txt}->{res}      16
{txt}Number of variables            {res}      17   {txt}->{res}       3
{txt}j variable (16 values)                    ->   {res}j
{txt}xij variables:
                    {res}var1 var2 ... var16   {txt}->   {res}var
{txt}{hline 77}

{com}.         drop index
{txt}
{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c TRC}
     {c |} {res} j   var {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
  1. {c |} {res} 1     4 {txt}{c |}
  2. {c |} {res} 2     8 {txt}{c |}
  3. {c |} {res} 3    22 {txt}{c |}
  4. {c |} {res} 4   120 {txt}{c |}
  5. {c |} {res} 5   227 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
  6. {c |} {res} 6   268 {txt}{c |}
  7. {c |} {res} 7   288 {txt}{c |}
  8. {c |} {res} 8   322 {txt}{c |}
  9. {c |} {res} 9   328 {txt}{c |}
 10. {c |} {res}10   359 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
 11. {c |} {res}11   372 {txt}{c |}
 12. {c |} {res}12   377 {txt}{c |}
 13. {c |} {res}13   381 {txt}{c |}
 14. {c |} {res}14   382 {txt}{c |}
 15. {c |} {res}15   391 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c RT}
 16. {c |} {res}16   445 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c BRC}

{com}. 
. /** we started with 1917 individuals; add a column to count how many people reached the question  */
.         
.         tsset j
{res}{txt}{col 9}time variable:  {res}{col 25}j, 1 to 16
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}.         gen surviors=1917-l.var
{txt}(1 missing value generated)

{com}.         replace surviors=1917 in 1
{txt}(1 real change made)

{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c TRC}
     {c |} {res} j   var   surviors {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
  1. {c |} {res} 1     4       1917 {txt}{c |}
  2. {c |} {res} 2     8       1913 {txt}{c |}
  3. {c |} {res} 3    22       1909 {txt}{c |}
  4. {c |} {res} 4   120       1895 {txt}{c |}
  5. {c |} {res} 5   227       1797 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
  6. {c |} {res} 6   268       1690 {txt}{c |}
  7. {c |} {res} 7   288       1649 {txt}{c |}
  8. {c |} {res} 8   322       1629 {txt}{c |}
  9. {c |} {res} 9   328       1595 {txt}{c |}
 10. {c |} {res}10   359       1589 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
 11. {c |} {res}11   372       1558 {txt}{c |}
 12. {c |} {res}12   377       1545 {txt}{c |}
 13. {c |} {res}13   381       1540 {txt}{c |}
 14. {c |} {res}14   382       1536 {txt}{c |}
 15. {c |} {res}15   391       1535 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c RT}
 16. {c |} {res}16   445       1526 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c BRC}

{com}. 
. /* now we have the total number of people who have quit by each question and the number who reached the question;
>    now we need the number who quit at each question (not the total who have quit by then) */
. 
.         set more off
{txt}
{com}.         gen fails=var-l.var
{txt}(1 missing value generated)

{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c TRC}
     {c |} {res} j   var   surviors   fails {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  1. {c |} {res} 1     4       1917       . {txt}{c |}
  2. {c |} {res} 2     8       1913       4 {txt}{c |}
  3. {c |} {res} 3    22       1909      14 {txt}{c |}
  4. {c |} {res} 4   120       1895      98 {txt}{c |}
  5. {c |} {res} 5   227       1797     107 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  6. {c |} {res} 6   268       1690      41 {txt}{c |}
  7. {c |} {res} 7   288       1649      20 {txt}{c |}
  8. {c |} {res} 8   322       1629      34 {txt}{c |}
  9. {c |} {res} 9   328       1595       6 {txt}{c |}
 10. {c |} {res}10   359       1589      31 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
 11. {c |} {res}11   372       1558      13 {txt}{c |}
 12. {c |} {res}12   377       1545       5 {txt}{c |}
 13. {c |} {res}13   381       1540       4 {txt}{c |}
 14. {c |} {res}14   382       1536       1 {txt}{c |}
 15. {c |} {res}15   391       1535       9 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
 16. {c |} {res}16   445       1526      54 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c BRC}

{com}.         replace fail=4 in 1
{txt}(1 real change made)

{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c TRC}
     {c |} {res} j   var   surviors   fails {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  1. {c |} {res} 1     4       1917       4 {txt}{c |}
  2. {c |} {res} 2     8       1913       4 {txt}{c |}
  3. {c |} {res} 3    22       1909      14 {txt}{c |}
  4. {c |} {res} 4   120       1895      98 {txt}{c |}
  5. {c |} {res} 5   227       1797     107 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
  6. {c |} {res} 6   268       1690      41 {txt}{c |}
  7. {c |} {res} 7   288       1649      20 {txt}{c |}
  8. {c |} {res} 8   322       1629      34 {txt}{c |}
  9. {c |} {res} 9   328       1595       6 {txt}{c |}
 10. {c |} {res}10   359       1589      31 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
 11. {c |} {res}11   372       1558      13 {txt}{c |}
 12. {c |} {res}12   377       1545       5 {txt}{c |}
 13. {c |} {res}13   381       1540       4 {txt}{c |}
 14. {c |} {res}14   382       1536       1 {txt}{c |}
 15. {c |} {res}15   391       1535       9 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c RT}
 16. {c |} {res}16   445       1526      54 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c BRC}

{com}. 
. /** Get the hazard rate for each question **/
.    
.         set more off
{txt}
{com}.         capture drop hazard
{txt}
{com}.         gen hazard=fail/surviors
{txt}
{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c TRC}
     {c |} {res} j   var   surviors   fails     hazard {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
  1. {c |} {res} 1     4       1917       4   .0020866 {txt}{c |}
  2. {c |} {res} 2     8       1913       4    .002091 {txt}{c |}
  3. {c |} {res} 3    22       1909      14   .0073337 {txt}{c |}
  4. {c |} {res} 4   120       1895      98    .051715 {txt}{c |}
  5. {c |} {res} 5   227       1797     107   .0595437 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
  6. {c |} {res} 6   268       1690      41   .0242604 {txt}{c |}
  7. {c |} {res} 7   288       1649      20   .0121286 {txt}{c |}
  8. {c |} {res} 8   322       1629      34   .0208717 {txt}{c |}
  9. {c |} {res} 9   328       1595       6   .0037618 {txt}{c |}
 10. {c |} {res}10   359       1589      31   .0195091 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
 11. {c |} {res}11   372       1558      13    .008344 {txt}{c |}
 12. {c |} {res}12   377       1545       5   .0032362 {txt}{c |}
 13. {c |} {res}13   381       1540       4   .0025974 {txt}{c |}
 14. {c |} {res}14   382       1536       1    .000651 {txt}{c |}
 15. {c |} {res}15   391       1535       9   .0058632 {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c RT}
 16. {c |} {res}16   445       1526      54   .0353866 {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c BRC}

{com}.  
. /** [Figure 2] DK Graph **/
. 
.         gen varlab=""  
{txt}(16 missing values generated)

{com}.         local kk=1
{txt}
{com}.         foreach vv in "Political interest" "Political knowledge" "Party recognition" ///
>                 "Party LR position" "Party tax posistion" "Party EU position" ///
>                 "Party asylum position" "Party policy influence" "Party frequency in cabinet" ///
>                 "Party role in cabinet" "Evaluation of economy" "News awareness: scandal" ///
>                 "News awareness: UK election" "News awareness: work hours" "Vote intention" ///
>                 "Expected seats" {c -(} 
{txt}  2{com}.                 replace varlab="`vv'" in `kk' 
{txt}  3{com}.                 local kk=`kk'+1
{txt}  4{com}.         {c )-}
{txt}varlab was {res}str1{txt} now {res}str18
{txt}(1 real change made)
varlab was {res}str18{txt} now {res}str19
{txt}(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
varlab was {res}str19{txt} now {res}str21
{txt}(1 real change made)
varlab was {res}str21{txt} now {res}str22
{txt}(1 real change made)
varlab was {res}str22{txt} now {res}str26
{txt}(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
varlab was {res}str26{txt} now {res}str27
{txt}(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)

{com}.         set more off
{txt}
{com}.         list
{txt}
     {c TLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 29}{c TRC}
     {c |} {res} j   var   surviors   fails     hazard                        varlab {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 29}{c RT}
  1. {c |} {res} 1     4       1917       4   .0020866            Political interest {txt}{c |}
  2. {c |} {res} 2     8       1913       4    .002091           Political knowledge {txt}{c |}
  3. {c |} {res} 3    22       1909      14   .0073337             Party recognition {txt}{c |}
  4. {c |} {res} 4   120       1895      98    .051715             Party LR position {txt}{c |}
  5. {c |} {res} 5   227       1797     107   .0595437           Party tax posistion {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 29}{c RT}
  6. {c |} {res} 6   268       1690      41   .0242604             Party EU position {txt}{c |}
  7. {c |} {res} 7   288       1649      20   .0121286         Party asylum position {txt}{c |}
  8. {c |} {res} 8   322       1629      34   .0208717        Party policy influence {txt}{c |}
  9. {c |} {res} 9   328       1595       6   .0037618    Party frequency in cabinet {txt}{c |}
 10. {c |} {res}10   359       1589      31   .0195091         Party role in cabinet {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 29}{c RT}
 11. {c |} {res}11   372       1558      13    .008344         Evaluation of economy {txt}{c |}
 12. {c |} {res}12   377       1545       5   .0032362       News awareness: scandal {txt}{c |}
 13. {c |} {res}13   381       1540       4   .0025974   News awareness: UK election {txt}{c |}
 14. {c |} {res}14   382       1536       1    .000651    News awareness: work hours {txt}{c |}
 15. {c |} {res}15   391       1535       9   .0058632                Vote intention {txt}{c |}
     {c LT}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 29}{c RT}
 16. {c |} {res}16   445       1526      54   .0353866                Expected seats {txt}{c |}
     {c BLC}{hline 4}{c -}{hline 5}{c -}{hline 10}{c -}{hline 7}{c -}{hline 10}{c -}{hline 29}{c BRC}

{com}. 
.         graph bar hazard, over(varlab, sort(j)) horizontal ytitle("Hazard Rate") ///
>                 title("Denmark") name(figure2_dk, replace)
{res}{txt}
{com}.                 
. /** [Figure 2] UK and DK combined **/
. 
.         graph combine figure2_uk figure2_dk, xsize(4) ysize(1.6) colfirst iscale(*1.5) imargin(zero) graphregion(margin(zero)) plotregion(margin(tiny))
{res}{txt}
{com}.         graph export "figure2.pdf", replace
{txt}(file /Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/figure2.pdf written in PDF format)

{com}.         
.         
.         
. *\END
. 
{txt}end of do-file

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}/Users/SEONGHUI/Dropbox/16-PSRM/PSRM2016/Replication Files/Dataverse 3/hazard.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}11 Apr 2017, 14:13:45
{txt}{.-}
{smcl}
{txt}{sf}{ul off}